﻿using System;
using System.Runtime.Serialization;

namespace Hippo.Framework.Model
{
    /// <summary>
    /// Model class for the test result
    /// </summary>
    [Serializable]
    [DataContract]
    public class TestResult
    {
        public TestResult(string agentName, string testName)
        {
            AgentName = agentName;
            TestName = testName;
        }

        /// <summary>
        /// Gets or sets the name of the agent.
        /// </summary>
        /// <value>The name of the agent.</value>
        [DataMember]
        public string AgentName { get; set; }

        /// <summary>
        /// Gets or sets the name of the test.
        /// </summary>
        /// <value>The name of the test.</value>
        [DataMember]
        public string TestName { get; set; }

        /// <summary>
        /// Gets or sets the test run identifier. This is unique for every call to IControlServiceCallback.StartTest()
        /// </summary>
        /// <value>The test run identifier.</value>
        [DataMember]
        public Guid TestRunIdentifier { get; set; }

        /// <summary>
        /// Gets or sets the resource. Indicates what ElapsedMilliseconds has measured.
        /// </summary>
        /// <value>The resource.</value>
        [DataMember]
        public string Resource { get; set; }

        /// <summary>
        /// Gets or sets the milliseconds it took to complete this step.
        /// </summary>
        /// <value>The milliseconds.</value>
        [DataMember]
        public long ElapsedMilliseconds { get; set; }

        /// <summary>
        /// Gets or sets the sub test results. A sub test result could be a logo gif within a web resource test.
        /// </summary>
        /// <value>The sub results.</value>
        [DataMember]
        public TestResult[] SubResults { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="TestResult"/> is success.
        /// </summary>
        /// <value><c>true</c> if success; otherwise, <c>false</c>.</value>
        public bool Success { get; set; }
    }
}
